package com.taojiazheng.serviceImpl.user;

import com.taojiazheng.dao.user.UserDao;
import com.taojiazheng.entity.User;
import com.taojiazheng.entity.Userevaluate;
import com.taojiazheng.mapper.UserevaluateMapper;
import com.taojiazheng.mapper.UserinfoMapper;
import com.taojiazheng.service.user.UserEvaluateService;
import com.taojiazheng.so.user.UserEvaluateSo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author 赵成林
 * @date 2018/1/8 14:22
 */
@Service
public class UserEvaluateServiceImpl implements UserEvaluateService {
    @Autowired
    private UserevaluateMapper userevaluateMapper;
    @Autowired
    private UserDao userDao;

    public UserEvaluateServiceImpl() {
        super();
    }

    @Override
    public void createUserEvaluate(String token, UserEvaluateSo userEvaluateSo) {
        User user = userDao.getUserByToken(token);
        Userevaluate userevaluate = new Userevaluate();
        userevaluate.setDate(new Date());
        userevaluate.setEvaluateUserId(userEvaluateSo.getEvaluateUserId());
        userevaluate.setEvaluate(userEvaluateSo.getEvaluate());
        userevaluate.setScore(userEvaluateSo.getScore());
        userevaluate.setUserId(user.getId());
        userevaluateMapper.insert(userevaluate);

    }
}
